package org.ah.ssm.controller;

import java.util.Map;

import org.ah.ssm.ahutils.AhConst;
import org.ah.ssm.ahutils.AhUtils;
import org.ah.ssm.entity.Examinee;
import org.ah.ssm.entity.Question;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.SessionAttributes;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.view.RedirectView;

@SessionAttributes("examUser")
@Controller
@RequestMapping("ctr_login")
public class LoginController {
	// 登陆成功
	@RequestMapping(value = "ctr_method_login", method = RequestMethod.POST)
	public ModelAndView c_dologin(Examinee examinee, Map<String, Object> map) {
		if (AhUtils.ahIsNullOrEmpty(examinee.getExaName())
				|| AhUtils.ahIsNullOrEmpty(examinee.getExaId())) {
			return new ModelAndView(AhConst.JSP_LOGIN, AhConst.ATTR_ERR_MSG,
					"请输入信息");

		} else {
			map.put(AhConst.ATTR_EXAMINEE, examinee);
			RedirectView redirectView = new RedirectView(
					"../ctr_question/ctr_method_qs");
			return new ModelAndView(redirectView);
		}
	}

}
